package com.scnu409.mimicontact;

import com.scnu409.utils.Person;

import android.app.ActionBar;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;

public class UserInf extends Activity {

	/*
	 * 
	 * @see android.app.Activity#onCreate(android.os.Bundle)
	 * @param userImg 用户头像
	 * @param userName 用户名
	 */
	
	ImageView userImg;
	TextView userName;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_user_inf);
		ActionBar actionBar;
		actionBar=getActionBar();
		
		actionBar.setIcon(R.drawable.ic_menu_back);
		actionBar.setHomeButtonEnabled(true);
		actionBar.setDisplayShowHomeEnabled(true);//取出actionbar的头像
		
		userImg=(ImageView)findViewById(R.id.userImg);
		userName=(TextView)findViewById(R.id.userName);
		Intent intent =getIntent();
		Person person =(Person)intent.getSerializableExtra("person");
		
		userImg.setImageResource(person.getImg());
		userName.setText(person.getName());
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem mi){
		if(mi.getItemId()==android.R.id.home){
			
			this.finish();
		}
		return true;
	}
}
